/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package firefighter;

import javax.microedition.lcdui.*;

/**
 *
 * @author matt
 */
public class HiScores extends Canvas implements CommandListener {

    private final Firefighter midlet;
    private Image hiScoresImage;
    private Command cmdBack;

    public HiScores(Firefighter midlet) {
        this.midlet = midlet;
        setFullScreenMode(true);
        hiScoresImage = Firefighter.createImage("/hiscoresScreen.png");
        cmdBack = new Command("", Command.BACK, 0);

        addCommand(cmdBack);
        setCommandListener(this);
    }

    public void paint(Graphics g) {
        int width = getWidth();
        int height = getHeight();
        g.setColor(0x00FFFFFF); // white
        g.fillRect(0, 0, width, height);
        g.setColor(0x00FF0000); // red
        g.drawRect(1, 1, width - 3, height - 3); // red border one pixel from edge

        g.drawImage(hiScoresImage, width / 2, height / 2, Graphics.VCENTER | Graphics.HCENTER);
    }

    public void commandAction(Command cmd, Displayable disp)
    {
        if (cmd == cmdBack)
        {
            midlet.hiScoresBack();
        }
    }
}
